[solved] IE6 PNG-transparency CSS hack not working

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-25T18:44:52Z Indexed on 2010/05/26 9:41 UTC
Read the original article Hit count: 246

Filed under:
|
|

I looked around and decided to use a CSS approach rather than rely on JS... I figure the kind of corporate users stuck with IE6 might also have JS disabled by IT departments.

So In my HTML I have:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
<link rel="stylesheet" type="text/css" href="default.css" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="ie6.css"><![endif]-->
</head>

<body>
    <img src="media/logo.png"/>
</body>

Then my ie6.css consists simply of:

img
{
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(...);
}

However none of this makes the slightest difference, no transparency. I commented out all the rest of the page so it is literally that one and still no luck. I removed the default.css stylesheet and still no difference.

EDIT: I now got it working, using the .htc method, loading that file in a conditional IE6 test block. It turned out the problem I was having was that Windows 7 had 'locked' the file (I don't even know what this means) and this blocked IE from loading/using it.

© Stack Overflow or respective owner

Related posts about css

Related posts about png